/*
 * claplan_oar.cc
 *
 *  Created on: 2 Nov 2013
 *      Author: Tom Vercauteren
 */

#include "claplan_oar.h"

#include "claplan_print.h"

using std::string;
using std::endl;

ClaplanOar::ClaplanOar() :
		anastruct(""), ntcp_model(""), ntcp_name(""), impf(0)
{
	cmi[0] = 0;
	cmi[1] = 0;

	mask.anastruct = 0;
	mask.ntcp_model = 0;
	mask.ntcp_name = 0;
	mask.impf = 0;
	mask.cmi = 0;
}

ClaplanOar::~ClaplanOar()
{
}

std::ostream & operator<<(std::ostream & os, const ClaplanOar &oar)
{
	os << "oar :" << endl;
	print_kv<string, string>(os, "anastruct", oar.anastruct);
	print_kv<string, string>(os, "NTCP_model", oar.ntcp_model);
	print_kv<string, string>(os, "NTCP_name", oar.ntcp_name);
	print_kv<string, double>(os, "impf", oar.impf);
	os << endl;
	print_kv<string, double>(os, "cmi", oar.cmi, 2);
	return os << endl;
}

const std::string& ClaplanOar::getAnastruct() const
{
	return anastruct;
}

void ClaplanOar::setAnastruct(const std::string& anastruct)
{
	this->anastruct = anastruct;
	mask.anastruct = 1;
}

void ClaplanOar::unsetAnastruct()
{
	this->anastruct = "";
	mask.anastruct = 0;
}

unsigned char ClaplanOar::isAnastructSet() const
{
	return mask.anastruct;
}

const double* ClaplanOar::getCmi() const
{
	return cmi;
}

void ClaplanOar::setCmi(const double *cmi)
{
	for (unsigned i = 0; i < 2; i++)
		this->cmi[i] = cmi[i];
	mask.cmi = 1;
}

void ClaplanOar::unsetCmi()
{
	for (unsigned i = 0; i < 2; i++)
		this->cmi[i] = 0;
	mask.cmi = 0;
}

unsigned char ClaplanOar::isCmiSet() const
{
	return mask.cmi;
}

double ClaplanOar::getImpf() const
{
	return impf;
}

void ClaplanOar::setImpf(double impf)
{
	this->impf = impf;
	mask.impf = 1;
}

void ClaplanOar::unsetImpf()
{
	this->impf = 0;
	mask.impf = 0;
}

unsigned char ClaplanOar::isImpfSet() const
{
	return mask.impf;
}

const std::string& ClaplanOar::getNtcpModel() const
{
	return ntcp_model;
}

void ClaplanOar::setNtcpModel(const std::string& ntcpModel)
{
	ntcp_model = ntcpModel;
	mask.ntcp_model = 1;
}

void ClaplanOar::unsetNtcpModel()
{
	ntcp_model = "";
	mask.ntcp_model = 0;
}

unsigned char ClaplanOar::isNtcpModelSet() const
{
	return mask.ntcp_model;
}

const std::string& ClaplanOar::getNtcpName() const
{
	return ntcp_name;
}

void ClaplanOar::setNtcpName(const std::string& ntcpName)
{
	ntcp_name = ntcpName;
	mask.ntcp_name = 1;
}

void ClaplanOar::unsetNtcpName()
{
	ntcp_name = "";
	mask.ntcp_name = 0;
}

unsigned char ClaplanOar::isNtcpNameSet() const
{
	return mask.ntcp_name;
}
